package net.openl10n.mdf;

public final class PartId implements Comparable<PartId> {
	
	private final String id;
	
	public PartId(String id) {
		if(id == null){
			throw new IllegalArgumentException("id cannot be null");
		}
		this.id = id.intern();
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj == this) return true;
		if (!(obj instanceof PartId) ) return false;
		return this.id == ((PartId)obj).id;
	}
	
	@Override
	public int hashCode() {
		return id.hashCode();
	}
	
	@Override
	public int compareTo(PartId o) {
		return id.compareTo(o.id);
	}
	
	@Override
	public String toString() {
		return id;
	}

}
